package com.happyelements.display
{
	import com.happyelements.cache.constants.AnimationCacheStrategy;
	import com.happyelements.display.rendering.AnimationRenderer;
	
	/**
	 *
	 * @author Steven
	 *
	 */
	public final class HEMovieClip extends HEDisplayObject
	{
		public function HEMovieClip(url:String, animationClass:String, action:String, scale:Number = 1.0, alpha:Number = 1.0, 
											   cacheStrategy:uint = AnimationCacheStrategy.CACHE_AS_NEEDED)
		{
			this.renderer = new AnimationRenderer(url, animationClass, scale, alpha);
			
			AnimationRenderer(renderer).action = action;
			AnimationRenderer(renderer).cacheStrategy = cacheStrategy;
		}
		
		public function set animationStatus(value:uint):void
		{
			AnimationRenderer(renderer).status = value;
		}
		
		public function get animationStatus():uint
		{
			return AnimationRenderer(renderer).status;
		}
		
		public function set animationCacheStrategy(value:uint):void
		{
			AnimationRenderer(renderer).cacheStrategy = value;
		}
		
		public function get animationCacheStrategy():uint
		{
			return AnimationRenderer(renderer).cacheStrategy;
		}
		
		override protected final function afterUpdate():void
		{
			AnimationRenderer(renderer).nextFrame();
		}
	}
}